<template>
  <div style="width: 100%;background: transparent">
    <div style="position: relative;z-index: 200;height: 3rem">
      <top-header :title="pageTitle"
                  :hasBack="true" :hasCart="true"
                  :hasSearch="true"
                  titleType="classify"
                  :isShowFirstClassify="isShowFirstClassify"
                  @showClassify="showClassify">
      </top-header>

      <pop-up ref="classifyModle" :maxHeight="0.8" @close="close" @hideClassify="hideClassify">
        <ClassifyFirstList
          @hideClassify="hideClassify"
          :classifyData="classifyList">
        </ClassifyFirstList>
      </pop-up>
    </div>

  </div>

</template>

<script>
  import TopHeader from '@/real-containers/header'
  import PopUp from '@/real-components/PopUps'
  import {mapGetters} from 'vuex'
  import ClassifyFirstList from '../ClassifyFirstList'
  import {getPageTree, initDomTree} from '../../../utils/getPageTree'

  export default {
    data() {
      return {
        page: "goodsClassify",
        componentName: "goodsClassifyHeader",
        isShowFirstClassify: false,
      }
    },

    components: {TopHeader, PopUp, ClassifyFirstList},

    props: {
      pageTitle: {
        type: String,
        default: ""
      },
      classifyList: {
        type: Array,
        default: () => []
      },
      goodsClassCode: {
        type: String,
        default: ''
      }
    },
    computed: {
      ...mapGetters([
        "getDomTree"
      ]),
      pageTree() {
        return getPageTree(this, this.page);
      }
    },

    methods: {
      //关闭下拉菜单
      showClassify() {
//        this.hidePopUp()
        if (this.isShowFirstClassify) {
          this.hideClassify()
          return
        }
        this.$refs.tabHead && this.$refs.tabHead.hidePopUp()
        this.isShowFirstClassify = true
        this.$refs.classifyModle && this.$refs.classifyModle.showPopUp()
      },
      hideClassify() {
        this.isShowFirstClassify = false
        this.$refs.classifyModle && this.$refs.classifyModle.hidePopUp()
      },
      close() {
        this.isShowFirstClassify = false
      }
    },
    beforeCreate() {
      var index = this.$route.query.pageIndex
    },
    created() {
    },
    mounted() {

    },
    updated() {
    }
  }
</script>

<style>

</style>
